﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/Master.master" AutoEventWireup="true" CodeFile="adminsanpham.aspx.cs" Inherits="Admin_admin_sanpham" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server">

</asp:Content>


<asp:Content ID="Content2" runat="server" 
    contentplaceholderid="ContentPlaceHolder1">
    <asp:Panel ID="PnlQL_Ly_Sp" runat="server">
        <table cellpadding="0" cellspacing="0" 
            style="width: 100%; border: thin solid #FF00FF">
            <tr>
                <td>
                    <table cellpadding="0" cellspacing="0" style="width: 100%">
                        <tr>
                            <td>
                            <div align="center"><p>QU&#7842;N L&Yacute; S&#7842;N PH&#7848;M</p>
                     <asp:Repeater ID="Repeater1" OnItemCommand="rept_ItemCommand" runat="server">
    <HeaderTemplate> 
    <%--<link href="../Styles/Site.css" rel="stylesheet" type="text/css" />--%>
    <div>
    <table class="item1" border=1>
    <th>M&atilde; SP</th>
    <th>T&ecirc;n SP</th>
    <th>M&ocirc; T&#7843;</th>
    <th>&#272;&#417;n Gi&aacute;</th>
    <th>Tr&#7841;ng Th&aacute;i</th>
    <th>H&igrave;nh</th>
    <th>M&atilde; &#272;H</th>
    <th>S&#7889;L&#432;&#7907;ng</th>
    <th>&#272;VT</th>
    <th>Ng&agrave;y CN</th>
    <th>X&oacute;a</th>
    <th>S&#7917;a</th>
    </div>
    </HeaderTemplate>
    <ItemTemplate>
    <tr>
    <td>
    <asp:Label ID="lblmasp" runat="server" Text='<%#Eval("masp") %>'></asp:Label>
    <asp:TextBox ID="txtmasp" runat="server" Text='<%#Eval("masp") %>' Visible="false"></asp:TextBox>
    </td>
    <td>
    <asp:Label ID="lbltensp" runat="server" Text='<%#Eval("tensp") %>'></asp:Label>
    <asp:TextBox ID="txtTensp" Width="100px" runat="server" Text='<%#Eval("tensp") %>' Visible="false"></asp:TextBox>
    </td>
    <td>
    <asp:Label ID="lblmota" runat="server" Text='<%#Eval("mota") %>'></asp:Label>
    <asp:TextBox ID="txtmota" runat="server" Text='<%#Eval("mota") %>' Visible="false"></asp:TextBox>
    </td>
    <td>
    <asp:Label ID="lbldongia" runat="server" Text='<%#Eval("dongia") %>'></asp:Label>
    <asp:TextBox ID="txtdongia" runat="server" Text='<%#Eval("dongia") %>' Visible="false"></asp:TextBox>
    </td>
    <td>
    <asp:Label ID="lbltrangthai" runat="server" Text='<%#Eval("trangthai") %>'></asp:Label>
    <asp:TextBox ID="txttrangthai" Width="100px"  runat="server" Text='<%#Eval("trangthai") %>' Visible="false"></asp:TextBox>
    </td>
    <td>
    <asp:Label ID="lblhinh" runat="server" Text='<%#Eval("hinh") %>'></asp:Label>
    <asp:TextBox ID="txthinh" runat="server" Text='<%#Eval("hinh") %>' Visible="false"></asp:TextBox>
    </td>
    <td>
    <asp:Label ID="lblmadm" runat="server" Text='<%#Eval("madm") %>'></asp:Label>
    <asp:TextBox ID="txtmadm" runat="server" Text='<%#Eval("madm") %>' Visible="false"></asp:TextBox>
    </td>
    <td>
    <asp:Label ID="lblsoluong" runat="server" Text='<%#Eval("soluong") %>'></asp:Label>
    <asp:TextBox ID="txtsoluong" runat="server" Text='<%#Eval("soluong") %>' Visible="false"></asp:TextBox>
    </td>
    <td>
    <asp:Label ID="lbldonvitinh" runat="server" Text='<%#Eval("donvitinh") %>'></asp:Label>
    <asp:TextBox ID="txtdonvitinh" runat="server" Text='<%#Eval("donvitinh") %>' Visible="false"></asp:TextBox>
    </td>
    <td>
    <asp:Label ID="lblngaycapnhat" runat="server" Text='<%#Eval("ngaycapnhat") %>'></asp:Label>
    <asp:TextBox ID="txtngaycapnhat" runat="server" Text='<%#Eval("ngaycapnhat") %>' Visible="false"></asp:TextBox>
    </td>
    <td>
    <asp:LinkButton CommandArgument='<%#Eval("masp") %>' CommandName="Xoa" ID="Button1" runat="server">X&oacute;a</asp:LinkButton>
    </td>
    <td>
    <asp:LinkButton ID="LinkSua" CommandArgument='<%#Eval("masp") %>' CommandName="Sua" runat="server">S&#7917;a</asp:LinkButton>
    <asp:LinkButton ID="LinkLuu" CommandArgument='<%#Eval("masp") %>' CommandName="Luu" runat="server" Visible="false">L&#432;u</asp:LinkButton>
    <asp:LinkButton ID="LinkDung" CommandArgument='<%#Eval("masp") %>' CommandName="Dung" runat="server" Visible="false">D&#7915;ng</asp:LinkButton>
    </td>
    <td>
         <ItemTemplate>
             <asp:HyperLink ID="HyperLink1" runat="server" ImageUrl="~/images/chitiet.jpg" 
              NavigateUrl='<%# "~/chitietsp.aspx?masp="+ Eval("masp") %>'>HyperLink</asp:HyperLink>
         </ItemTemplate>
    </td>
    </tr>
    </ItemTemplate>
    <FooterTemplate>
    </table>
    </FooterTemplate>
    </asp:Repeater>
                             </div>
                                <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                                    ConflictDetection="CompareAllValues" 
                                    ConnectionString="<%$ ConnectionStrings:D:\HỌC TẬP KỲ 2 - 2013\HOC TAP KY 1 2013-2014\THUONG MAI DIEN TU\QUANLYSHOPTHOITRANG\CHECK-OUT TOI THU 2\APP_DATA\QLSHOPTT.MDF ConnectionString %>" 
                                    DeleteCommand="DELETE FROM [SanPham] WHERE
                                     [masp] = @original_masp 
                                     AND (([tensp] = @original_tensp) OR ([tensp] IS NULL AND @original_tensp IS NULL))
                                     AND (([mota] = @original_mota) OR ([mota] IS NULL AND @original_mota IS NULL))
                                     AND (([dongia] = @original_dongia) OR ([dongia] IS NULL AND @original_dongia IS NULL))
                                     AND (([trangthai] = @original_trangthai)OR ([trangthai] IS NULL AND @original_trangthai IS NULL)) 
                                     AND (([hinh] = @original_hinh) OR ([hinh] IS NULL AND @original_hinh IS NULL))
                                     AND (([madm] = @original_madm) OR ([madm] IS NULL AND @original_madm IS NULL))
                                     AND (([soluong] = @original_soluong) OR ([soluong] IS NULL AND @original_soluong IS NULL)) 
                                     AND (([donvitinh] = @original_donvitinh)OR ([donvitinh] IS NULL AND @original_donvitinh IS NULL))
                                     AND (([ngaycapnhat] = @original_ngaycapnhat) OR ([ngaycapnhat] IS NULL AND @original_ngaycapnhat IS NULL))" 
                                    InsertCommand="INSERT INTO [SanPham] ([tensp], [mota], [dongia], [trangthai], [hinh], [madm], [soluong], [donvitinh], [ngaycapnhat])
                                     VALUES (@tensp, @mota, @dongia, @trangthai, @hinh, @madm, @soluong, @donvitinh, @ngaycapnhat)" 
                                    OldValuesParameterFormatString="original_{0}" 
                                    SelectCommand="SELECT * FROM [SanPham]" 
                                    
                                    
                                    UpdateCommand="UPDATE [SanPham] SET [tensp] = @tensp, [mota] = @mota, [dongia] = @dongia,  [hinh] = @hinh, [madm] = @madm, [soluong] = @soluong, [donvitinh] = @donvitinh, [ngaycapnhat] = @ngaycapnhat 
                                    WHERE [masp] = @original_masp 
                                    AND (([tensp] = @original_tensp) OR ([tensp] IS NULL AND @original_tensp IS NULL)) 
                                    AND (([mota] = @original_mota) OR ([mota] IS NULL AND @original_mota IS NULL)) 
                                    AND (([dongia] = @original_dongia) OR ([dongia] IS NULL AND @original_dongia IS NULL)) 
                                    AND (([hinh] = @original_hinh) OR ([hinh] IS NULL AND @original_hinh IS NULL)) 
                                    AND (([madm] = @original_madm) OR ([madm] IS NULL AND @original_madm IS NULL)) 
                                    AND (([soluong] = @original_soluong) OR ([soluong] IS NULL AND @original_soluong IS NULL)) 
                                    AND (([donvitinh] = @original_donvitinh) OR ([donvitinh] IS NULL AND @original_donvitinh IS NULL)) 
                                    AND (([ngaycapnhat] = @original_ngaycapnhat) OR ([ngaycapnhat] IS NULL AND @original_ngaycapnhat IS NULL))">
                                    <DeleteParameters>
                                        <asp:Parameter Name="original_masp" Type="Int32" />
                                        <asp:Parameter Name="original_tensp" Type="String" />
                                        <asp:Parameter Name="original_mota" Type="String" />
                                        <asp:Parameter Name="original_dongia" Type="Int32" />
                                        <asp:Parameter Name="original_trangthai" Type="String" />
                                        <asp:Parameter Name="original_hinh" Type="String" />
                                        <asp:Parameter Name="original_madm" Type="Int32" />
                                        <asp:Parameter Name="original_soluong" Type="Int32" />
                                        <asp:Parameter Name="original_donvitinh" Type="String" />
                                        <asp:Parameter Name="original_ngaycapnhat" Type="DateTime" />
                                    </DeleteParameters>
                                    <InsertParameters>
                                        <asp:Parameter Name="tensp" Type="String" />
                                        <asp:Parameter Name="mota" Type="String" />
                                        <asp:Parameter Name="dongia" Type="Int32" />
                                        <asp:Parameter Name="trangthai" Type="String" />
                                        <asp:Parameter Name="hinh" Type="String" />
                                        <asp:Parameter Name="madm" Type="Int32" />
                                        <asp:Parameter Name="soluong" Type="Int32" />
                                        <asp:Parameter Name="donvitinh" Type="String" />
                                        <asp:Parameter Name="ngaycapnhat" Type="DateTime" />
                                    </InsertParameters>
                                    <UpdateParameters>
                                        
                                        <asp:Parameter Name="tensp" />
                                        <asp:Parameter Name="mota" />
                                        <asp:Parameter Name="dongia" />
                                        <asp:Parameter Name="hinh" />
                                        <asp:Parameter Name="madm" />
                                        <asp:Parameter Name="soluong" />
                                        <asp:Parameter Name="donvitinh" />
                                        <asp:Parameter Name="ngaycapnhat" />
                                        
                                        <asp:Parameter Name="original_masp" Type="Int32" />
                                        <asp:Parameter Name="original_tensp" Type="String" />
                                        <asp:Parameter Name="original_mota" Type="String" />
                                        <asp:Parameter Name="original_dongia" Type="Int32" />
                                        <asp:Parameter Name="original_hinh" Type="String" />
                                        <asp:Parameter Name="original_madm" Type="Int32" />
                                        <asp:Parameter Name="original_soluong" Type="Int32" />
                                        <asp:Parameter Name="original_donvitinh" Type="String" />
                                        <asp:Parameter Name="original_ngaycapnhat" Type="DateTime" />
                                    </UpdateParameters>
                                </asp:SqlDataSource>
                                <br />
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td>
                    <table align="center" cellpadding="0" cellspacing="0" style="width: 90%">
                        <tr>
                            <td colspan="2" style="text-align: left">
                                <asp:Label ID="lbthongbao" runat="server" ForeColor="#FF0066" 
                                    style="font-size: x-large; font-weight: 700"></asp:Label>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2" style="text-align: left">
                                <hr style="border-width: thin; border-color: #CCFFCC" width="95%" />
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2" 
                                style="text-align: center; font-size: x-large; color: #99CCFF; padding-left: 5px;">
                                <b style="text-align: center">Th&ecirc;m s&#7843;n ph&#7849;m m&#7899;i</b></td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <hr style="border-width: thin; border-color: #CCFFCC" width="95%" />
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                &nbsp;</td>
                        </tr>
                        <tr>
                            <td style="text-align: left; padding-left: 30px; color: #9966FF; font-size: 14px; font-weight: bold;" 
                                width="30%">
                                &nbsp;</td>
                            <td style="text-align: left; padding-bottom: 10px;">
                                &nbsp;</td>
                        </tr>
                        <tr>
                            <td style="text-align: left; padding-left: 30px; color: #9966FF; font-size: 14px; font-weight: bold;" 
                                width="30%">
                                DANH M&#7908;C</td>
                            <td style="text-align: left; padding-bottom: 10px;">
                                <asp:DropDownList ID="ddldanhmuc" runat="server" DataSourceID="SQLDanhMuc" 
                                    DataTextField="tendm" DataValueField="madm">
                                </asp:DropDownList>
                                <asp:SqlDataSource ID="SQLDanhMuc" runat="server" 
                                    ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
                                    SelectCommand="SELECT [madm], [tendm] FROM [DanhMuc]"></asp:SqlDataSource>
                            </td>
                        </tr>
                        <tr>
                            <td style="text-align: left; padding-left: 30px; color: #9966FF; font-size: 14px; font-weight: bold;" 
                                valign="middle" width="30%">
                                T&Ecirc;N S&#7842;N PH&#7848;M</td>
                            <td style="text-align: left; padding-bottom: 10px;">
                                <asp:TextBox ID="txttensp" runat="server" Width="500px"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                                    ControlToValidate="txttensp" ErrorMessage="Vui l&ograve;ng nh&#7853;p t&ecirc;n s&#7843;n ph&#7849;m" 
                                    ValidationGroup="themsp">(*)</asp:RequiredFieldValidator>
                            </td>
                        </tr>
                        <tr>
                            <td style="text-align: left; padding-left: 30px; color: #9966FF; font-size: 14px; font-weight: bold;" 
                                valign="middle" width="30%">
                                M&Ocirc; T&#7842; CHI TI&#7870;T</td>
                            <td style="text-align: left; padding-bottom: 10px;">
                                <asp:TextBox ID="txtmota" runat="server" Height="100px" TextMode="MultiLine" 
                                    Width="500px"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td style="text-align: left; padding-left: 30px; color: #9966FF; font-size: 14px; font-weight: bold;" 
                                valign="middle" width="30%">
                                NG&Agrave;Y C&#7852;P NH&#7852;T</td>
                            <td style="text-align: left; padding-bottom: 10px;">
                                <asp:Calendar ID="calngaycapnhat" runat="server" BackColor="White" 
                                    BorderColor="#999999" CellPadding="4" DayNameFormat="Shortest" 
                                    Font-Names="Verdana" Font-Size="8pt" ForeColor="Black" Height="180px" 
                                    Width="250px">
                                    <SelectedDayStyle BackColor="#666666" Font-Bold="True" ForeColor="White" />
                                    <SelectorStyle BackColor="#CCCCCC" />
                                    <WeekendDayStyle BackColor="#FFFFCC" />
                                    <TodayDayStyle BackColor="#CCCCCC" ForeColor="Black" />
                                    <OtherMonthDayStyle ForeColor="#808080" />
                                    <NextPrevStyle VerticalAlign="Bottom" />
                                    <DayHeaderStyle BackColor="#CCCCCC" Font-Bold="True" Font-Size="7pt" />
                                    <TitleStyle BackColor="#999999" BorderColor="Black" Font-Bold="True" />
                                </asp:Calendar>
                            </td>
                        </tr>
                        <tr>
                            <td style="text-align: left; padding-left: 30px; color: #9966FF; font-size: 14px; font-weight: bold;" 
                                width="30%">
                                S&#7888; L&#431;&#7906;NG</td>
                            <td style="text-align: left; padding-bottom: 10px;">
                                <asp:TextBox ID="txtsoluongban" runat="server" Width="200px"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                                    ControlToValidate="txtsoluongban" 
                                    ErrorMessage="B&#7841;n ch&#432;a nh&#7853;p s&#7889; l&#432;&#7907;ng b&aacute;n c&#7911;a s&#7843;n ph&#7849;m" ValidationGroup="themsp">(*)</asp:RequiredFieldValidator>
                            </td>
                        </tr>
                        <tr>
                            <td style="text-align: left; padding-left: 30px; color: #9966FF; font-size: 14px; font-weight: bold;" 
                                width="30%">
                                &#272;&#416;N V&#7882; T&Iacute;NH</td>
                            <td style="text-align: left; padding-bottom: 10px;">
                                <asp:TextBox ID="txtdonvitinh" runat="server" Width="200px"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" 
                                    ControlToValidate="txtdonvitinh" 
                                    ErrorMessage="Ch&#432;a nh&#7853;p &#273;&#417;n v&#7883; t&iacute;nh c&#7911;a s&#7843;n ph&#7849;m" ValidationGroup="themsp">(*)</asp:RequiredFieldValidator>
                            </td>
                        </tr>
                        <tr>
                            <td style="text-align: left; padding-left: 30px; color: #9966FF; font-size: 14px; font-weight: bold;" 
                                width="30%">
                                &#272;&#416;N GI&Aacute;</td>
                            <td style="text-align: left; padding-bottom: 10px;">
                                <asp:TextBox ID="txtdongia" runat="server" Width="200px" AutoPostBack="True"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" 
                                    ControlToValidate="txtdongia" ErrorMessage="&#272;&#417;n gi&aacute; c&#7911;a s&#7843;n ph&#7849;m" 
                                    ValidationGroup="themsp">(*)</asp:RequiredFieldValidator>
                                <asp:CompareValidator ID="CompareValidator1" runat="server" 
                                    ControlToValidate="txtdongia" ErrorMessage="&#272;&#417;n gi&aacute; ph&#7843;i l&agrave; s&#7889;" 
                                    Operator="DataTypeCheck" Type="Integer" ValidationGroup="themsp">(*)</asp:CompareValidator>
                            </td>
                        </tr>
                        <tr>
                            <td style="text-align: left; padding-left: 30px; color: #9966FF; font-size: 14px; font-weight: bold;" 
                                width="30%">
                                H&Igrave;NH &#7842;NH MINH H&#7884;A</td>
                            <td style="text-align: left">
                                <asp:FileUpload ID="FUlhinhanh" runat="server" BackColor="White" 
                                    BorderColor="#FF99FF" Width="50%" />
                            </td>
                        </tr>
                        <tr>
                            <td style="text-align: left; padding-left: 20px; color: #9966FF; font-size: 14px; font-weight: bold;" 
                                width="30%">
                                &nbsp;</td>
                            <td>
                                &nbsp;</td>
                        </tr>
                        <tr>
                            <td style="text-align: left; padding-left: 20px; color: #9966FF; font-size: 14px; font-weight: bold;" 
                                width="30%">
                                &nbsp;</td>
                            <td style="text-align: left">
                                <asp:Button ID="btluuspmoi" runat="server" onclick="btluuspmoi_Click" 
                                    Text="L&#431;U S&#7842;N PH&#7848;M M&#7898;I" ValidationGroup="themsp" />
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2" 
                                style="text-align: left; padding-left: 0px; color: #9966FF; font-size: 14px; font-weight: bold;" 
                                width="30%">
                                <hr style="border-width: thin; border-color: #CCFFCC" width="95%" />
                            </td>
                        </tr>
                        <tr>
                            <td style="text-align: left; padding-left: 20px; color: #9966FF; font-size: 14px; font-weight: bold;" 
                                width="30%">
                                &nbsp;</td>
                            <td style="text-align: left">
                                <asp:ValidationSummary ID="ValidationSummary1" runat="server" 
                                    ValidationGroup="themsp" />
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2" 
                                style="text-align: left; color: #9966FF; font-size: 14px; font-weight: bold;" 
                                width="30%">
                                <hr style="border-width: thin; border-color: #CCFFCC" width="95%" />
                            </td>
                        </tr>
                        <tr>
                            <td style="text-align: left; padding-left: 20px; color: #9966FF; font-size: 14px; font-weight: bold;" 
                                width="30%">
                                &nbsp;</td>
                            <td>
                                &nbsp;</td>
                        </tr>
                    </table>
                    <br />
                </td>
            </tr>
        </table>
    </asp:Panel>
    </asp:Content>



